package com.magenta.maxoptra.scheduler.io;

import java.io.File;
import java.net.URL;

/*
* Project: MaxOptRA v1.2
* User: Ivan Usalko
* Date: 29.09.2009 14:14:44
*
* Copyright (c) 1999-2009 Magenta Corporation Ltd. All Rights Reserved.
* Magenta Technology proprietary and confidential.
* Use is subject to license terms.
*/
public class SearchFileUtils {

    public static String pathFromClassPath(URL resource, String cmd) {
        File localFile = new File(resource.getFile());
        if (localFile.isFile()) {
            return localFile.getParentFile().getAbsolutePath() + '/' + cmd;
        }
        if (localFile.isDirectory()) {
            return localFile.getAbsolutePath() + '/' + cmd;
        }
        throw new IllegalArgumentException();
    }

}
